﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Slb.Ocean.Petrel.DomainObject.Well;
using Slb.Ocean.Petrel.DomainObject;
using Slb.Ocean.Petrel;

namespace Public.Ocean.Petrel.Extensions.DomainObject
{
    public static class LogsExtensions
    {
        /// <summary>
        /// Creates the check shot with a given name.
        /// </summary>
        /// <param name="logs">The logs.</param>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public static CheckShot CreateCheckShot(this Logs logs, string name)
        {
            WellRoot root = WellRoot.Get(PetrelProject.PrimaryProject);
            PropertyVersion version = root.CheckShotVersions.FirstOrDefault(i => i.Name == name);
            if (version == null) { version = root.CreateCheckShotVersion(name); }
            return logs.CreateCheckShot(version);
        }
    }
}
